var express = require('express');
var router = express.Router();
let JWT = require('./../utils/jwt')

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

router.post('/loginIn', function(req, res, next) {
   let{usename,password} = req.body
   let Token = JWT.generateToken({usename},'1d')
    res.header('Authorization',Token)
    res.status(200).send({
      code: 0,
      data:Token,
      message: '登录成功'
    });
});

module.exports = router;
